# -*- coding = utf-8 -*-
# @Time    : 2025/6/10 16:25
# @Author  : 杨明明
# @File    : __init__.py.py
# @Software: PyCharm

import os

# 获取环境变量切换生产测试环境
# 获取并标准化环境变量值
env = os.getenv('DJANGO_ENV', 'development').strip().lower()

# 校验环境变量是否合法
if env not in ('development', 'production'):
    raise ValueError(f"Invalid DJANGO_ENV value: {env}. Expected 'development' or 'production'.")
try:
    if env == 'development':
        from .development import *
    else:
        from .production import *
except ImportError as e:
    # 提供更友好的错误提示
    raise ImportError(f"Failed to import configuration module for environment '{env}': {e}")
